package cn.zzp.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @ClassName JsonResult
 * @Description
 * @Author 祝志鹏
 * @Date 2022/7/17 10:15
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class JsonResult {
    /**
     * @Description 成功响应码
     */
    private Boolean success = true;

    /**
     * @Description 成功信息
     */
    private String message = "操作成功";

    /**
     * 携带信息
     */
    private Object obj ;


    public JsonResult(Boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public static JsonResult me(){
        return new JsonResult();
    }

    public static JsonResult me(Boolean success){
        return new JsonResult(success, "操作失败");
    }

    public static JsonResult me(String message){
        return new JsonResult(false, message);
    }

    public JsonResult setObj(Object obj){
        this.obj = obj;
        return this;
    }


}
